
namespace ItProject.Andir.Cryptography
{	
	/// <summary>
	/// TODO: Document this!!!
	/// </summary>
	public enum HavalPassCount
	{
		Pass3,
		Pass4,
		Pass5
	}
	
	/// <summary>
	/// TODO: Document this!!!
	/// </summary>
	public enum HavalHashSize
	{
		HashSize128 = 128,
		HashSize160 = 160,
		HashSize192 = 192,
		HashSize224 = 224,
		HashSize256 = 256
	}

	/// <summary>
	/// TODO: Document this!!!
	/// </summary>
	public class Haval
		: ItProject.Andir.Cryptography.BlockHashAlgorithm
	{
		/// <summary>
		/// TODO: Document this!!!
		/// </summary>
		public Haval(): this(HavalHashSize.HashSize256, HavalPassCount.Pass5){}

		/// <summary>
		/// TODO: Document this!!!
		/// </summary>
		public Haval(HavalHashSize size): this(size, HavalPassCount.Pass5){}

		/// <summary>
		/// TODO: Document this!!!
		/// </summary>
		/// <param name="passes"></param>
		public Haval(HavalPassCount passes): this(HavalHashSize.HashSize256, passes){}

		/// <summary>
		/// TODO: Document this!!!
		/// </summary>
		public Haval(HavalHashSize size, HavalPassCount passes)
			: base(Haval.CreateImpl(size, passes))
		{
			HashSizeValue = (int)size;
			
			Initialize();
		}

		private static IBlockHashAlghorithmImpl CreateImpl(HavalHashSize size, HavalPassCount passes)
		{
			switch(passes)
			{
				//case HavalPassCount.Pass3: return new Haval3Impl(size);
				//case HavalPassCount.Pass4: return new Haval4Impl(size);
				case HavalPassCount.Pass5: return new Haval5Impl(size);
			}

			return new Haval5Impl(size);
		}
	}
}
